<script setup>
import {ref,reactive,defineEmits,onBeforeUnmount} from 'vue';
const emits=defineEmits(['toBottom'])
let listBody=ref(null);

window.addEventListener('scroll',scrollFn);
// onBeforeUnmount(()=>{
//     window.removeEventListener('scroll',scrollFn);
// })
let timmer;
function scrollFn(e){
    if(timmer!=undefined) return;
    timmer=setTimeout(()=>{
        timmer=undefined;
    },300)
    let scrollDom=document.documentElement;
    // console.log(scrollDom.scrollTop+scrollDom.clientHeight,scrollDom.scrollHeight);
    if(scrollDom.scrollTop+scrollDom.clientHeight+100>scrollDom.scrollHeight){
        // console.log(-9);
        emits('toBottom')
    }
}
</script>

<template>
    <section>
        <slot></slot>
    </section>
</template> 

<style scoped>
</style>